-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Controller Module Header File #34
base: main
Are you sure you want to change the base?
Conversation
Have you looked at the embedded coding standard yet https://docs.waterloorocketry.com/general/standards/embedded-coding-standard.html |
float timestamp; // Timestamp in ms | ||
} controller_state_t; | ||
|
||
// Output of controller to be sent to servo via CAN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Output of controller to be sent to servo motor controller board via CAN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attitude is a 4 vector with the quaternions q0 - q3.
State vector also includes canard coefficient CL, and canard angle delta, which are both states
* @param output Pointer to store output -> type defined in state_estimation.h | ||
* @return false if no output available | ||
*/ | ||
bool Controller_Get_Latest_Output(control_output_SE_t *output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure state_estimation.h correctly defines control_output_SE_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some comments in the google doc
@Joe-Joe-Joe-Joe @FinnBreu can u guys also review the design in the google doc?
float actual_angle; // Current angle | ||
uint32_t timestamp; // Timestamp | ||
uint32_t servo_id; // Servo identifier | ||
} controller_can_output_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an internal thing right? does it need to be exposed in this .h
Comments in the gdoc |
#include <stdbool.h> | ||
|
||
/* Enums/Types */ | ||
typedef struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend a union for this. See https://github.com/xioTechnologies/Fusion/blob/main/Fusion/FusionMath.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#41
im gonna make vectors a common project-wide type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#44
pls use the project-wide vector type and lmk if the common types need changes
#define CONTROLLER_H_ | ||
|
||
#include "FreeRTOS.h" | ||
#include "state_estimation.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "application/estimator/estimator.h"
* Must be called before RTOS scheduler starts | ||
* @return true if initialization successful | ||
*/ | ||
bool controller_init(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the bools here should be replaced with w_status_t and include "rocketlib/include/common.h"
// 2.1 Gain table and flight conditions would go here (not shown) | ||
|
||
// 2.2 Controller initialization with memory checks | ||
float* g0 = (float*)malloc(sizeof(float)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we dynamically allocating all theese variables?
Added header file for controller modules